
public class p1002_3766ms {

	public static//
	// -----
	// -----
	class Main {
		public static void main(String[] args) throws Exception {
			final java.util.Map<Integer, Integer> map = new java.util.HashMap<Integer, Integer>();

			java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
			int size = Integer.parseInt(reader.readLine());
			for (int i = 0; i < size; i++) {
				int num = toNumber(reader.readLine());
				map.put(num, map.containsKey(num) ? map.get(num) + 1 : 1);
			}

			java.util.List<int[]> list = new java.util.ArrayList<int[]>();
			for (java.util.Map.Entry<Integer, Integer> is : map.entrySet()) {
				int v = is.getValue();
				if (v > 1)
					list.add(new int[] { is.getKey(), v });
			}

			if (list.isEmpty()) {
				System.out.println("No duplicates.");
				return;
			}
			java.util.Collections.sort(list, new java.util.Comparator<int[]>() {
				public int compare(int[] o1, int[] o2) {
					return o1[0] - o2[0];
				}
			});
			for (int[] entry : list) {
				int num = entry[0];
				System.out.printf("%03d-%04d %d\n", num / 10000, num % 10000, entry[1]);
			}
		}

		static int toNumber(String line) {
			int num = 0;
			for (int i = 0; i < line.length(); i++) {
				char c = line.charAt(i);
				if (c >= 'Q') {
					num = num * 10 + (c - 60) / 3;
				} else if (c >= 'A') {
					num = num * 10 + (c - 59) / 3;
				} else if (c >= '0') {
					num = num * 10 + (c - '0');
				}
			}
			return num;
		}
	}

	// -----
	// -----Q
	/**
	 * 0-9: 48-57, A-Z: 65-90 65-67 2 68-70 3 71-73 4 74-76 5 77-79 6 80-82 7
	 * 81-83 7 84-86 8 87-89 9 90
	 */
	// -----
	// -----

	public static void main(String[] args) throws Exception {
		Judge.run();
	}

}
